{template 'common/header'}
{php load()->func('tpl')}
{if $op == 'display'}
<ul class="nav nav-tabs">
	<li {if $op == 'display'}class="active"{/if}>
		<a href="{php echo $this->createWebUrl('search', array('op' => 'display'))}">查询管理</a>
	</li>
	<li {if $op == 'post'}class="active"{/if}>
		<a href="{php echo $this->createWebUrl('search', array('op' => 'post'))}">查询添加</a>
	</li>
</ul>
<div class="main">
<table class="table table-hover">
	<thead class="navbar-inner">
		<tr>
			<th class="row-hover span2">
				常用查询名称 <i></i>
			</th>
			<th class="row-hover span2">
				第三方网址
				<i></i>
			</th>
			<th class="row-hover span2">
				状态
				<i></i>
			</th>
			<th class="row-hover" style="min-width:370px;">操作</th>
			<th class="row-hover span1" style="text-align:right;width:100px;"></th>
		</tr>
	</thead>
	<tbody id="status-items">
		{loop $list $item}
		<tr>
			<td>{$item['sname']}</td>
			<td>{$item['surl']}</td>
			<td>
				{if empty($item['status'])}
					<a href='{php echo $this->createWebUrl('search',array('op' => 'display' ,'status' => '1','id' => $item['id']))}' class='btn btn-success'>开启</a>
				{else}
					<a href='{php echo $this->createWebUrl('search',array('op' => 'display' ,'status' => '0','id' => $item['id']))}' class='btn btn-danger'>关闭</a>
				{/if}
			</td>
			<td>
				<span>
					<a href="{php echo $this->createWebUrl('search',array('op'=>'post','id'=>$item['id']))}"><i class='glyphicon glyphicon-edit'></i>编辑
					</a>
					&nbsp;&nbsp;
					<a href="{php echo $this->createWebUrl('search',array('op'=>'delete','id'=>$item['id']))}" onclick="return confirm('此操作不可恢复，确认吗？');"><i class='glyphicon glyphicon-remove-circle'></i>删除
					</a>
				</span>
			</td>
		</tr>
		{/loop}
	</tbody>
</table>
</div>
{elseif $op == 'post'}
<ul class="nav nav-tabs">
<li {if $op == 'display'}class="active"{/if}>
	<a href="{php echo $this->createWebUrl('search', array('op' => 'display'))}">查询管理</a>
</li>
<li {if $op == 'post'}class="active"{/if}>
	<a href="{php echo $this->createWebUrl('search', array('op' => 'post'))}">查询添加</a>
</li>
</ul>

<form action="" class="form-horizontal form" method="post" enctype="multipart/form-data">
<input type="hidden" name="id" value="{$item['id']}">
<div class="panel panel-default">
  <div class="panel-heading">
    <h3 class="panel-title">查询添加</h3>
  </div>
  <div class="panel-body">
    <div class="form-group">
	    <label for="sname" class="col-sm-2 control-label">查询名称</label>
	    <div class="col-xs-3">
	      <input type="text" name="sname" value="{$item['sname']}" id='sname' class="form-control" placeHolder="请输入常用查询名称"/>
	    </div>
  	</div>
  	<div class="form-group">
	    <label for="sname" class="col-sm-2 control-label">第三方网址</label>
	    <div class="col-xs-4">
	    	{php echo tpl_form_field_link(surl,$item['surl'])}
			（注：链接需加http://）
	    </div>
  	</div>
  	<div class="form-group">
	    <label for="sname" class="col-sm-2 control-label">图标</label>
	    <div class="col-xs-3">
	      {php echo tpl_form_field_image('icon',$item['icon'])}
	    </div>
  	</div>
  	<div class="form-group">
	    <label for="sname" class="col-sm-2 control-label">状态</label>
	    <div class="col-xs-3">
	      <label for="ipt_status" class="checkbox-inline">
				<input class="" name="status" id="ipt_status" type="checkbox" value='1' {if intval($item['status'])==1}checked='checked'{/if} />
				开启
		  </label>
	    </div>
  	</div>
  	<div class="form-group">
	    <label for="" class="col-sm-2 control-label"></label>
	    <div class="col-sm-10">
	      <label for="ipt_status" class="checkbox">
				<button type="submit" class="btn btn-primary span3" name="submit" value="提交">提交</button>
			<input type="hidden" name="token" value="{$_W['token']}" />
		  </label>
	    </div>
  	</div>
  </div>
</div>
</form>
{/if}
{template 'common/footer'}